<!DOCTYPE html>
<html ng-app="myApp">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title><%= title %></title>
    <link rel='stylesheet' href='/stylesheets/style.css'/>
    <link rel="stylesheet" href="/bower_components/lightbox2/dist/css/lightbox.css" >
    <link rel="stylesheet" href="/bower_components/bootstrap/dist/css/bootstrap.min.css"/>
    <script src="/bower_components/jquery/dist/jquery.min.js"></script>
    <script src="/bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
    <script src="/bower_components/dropzone/dist/min/dropzone.min.js"></script>
    <script src="/bower_components/lightbox2/dist/js/lightbox.min.js" defer></script>
    <script  src="/bower_components/angular/angular.js"></script>
    <script src="/js/myjs/myjs.js"></script>
</head>
<body class="body_background">

<% include model/top.ejs %>
<div class="container">
    <% include model/prompt.ejs %>
    <div class="row">
        <div id="user_left" class="col-md-8 col-sm-8">
            <% if(posts) %>
            <% posts.forEach(function (post) { %>
            <div class="panel  panel-default col-md-12 col-sm-12 table-bordered user_left_content">

                <div class="panel-heading clearfix"><a class="h3 panel-title pull-left "
                                                       href="/content/<%= post._id %>"><%= post.title %></a>

                    <div class="pull-left content_info">作者：<a
                                href="/users/<%= post.name %>"><%= post.name %></a> |
                        日期：<%= post.time.minute %> |
                        点击量：<%= post.pv ? post.pv : "0" %> | 转载：
                        <% if (post.reprint_info.reprint_to) { %>
                        <%= post.reprint_info.reprint_to.length %>
                        <% } else { %>
                        <%= 0 %>
                        <% } %>
                    </div>
                </div>
                <div class="panel-body">
                    <div class="content_text"><%- post.post %></div>
                    <% if(post.img) { %>
                    <% post.img.forEach(function (img) { %>
                    <a target="_blank" data-lightbox="roadtrip<%= post._id %>" href=<%= img.sourceImg %>><img
                                class="content_img" src=<%= img.thumbnailImg %>></a>
                    <% }) %>
                    <% } %>
                </div>
                <div class="panel-footer clearfix">
                    <% if (user && (user.name == post.name)) { %>
                    <form action="/content/<%= post._id %>" style="display: inline" method="post">
                        <div class="btn-group pull-right ">
                            <a class="edit btn btn-primary btn-sm" href="#" data-toggle="modal"
                               data-target="#updateModal">编辑</a>
                            <input value="delete" type="hidden" name="_method">
                            <input class=" btn btn-primary btn-sm" type="submit" value="删除">
                        </div>
                    </form>
                    <% include model/updateModel.ejs %>
                    <% } %>
                            <% var flag = 1 %>
                            <% if (user && (user.name != post.name)) { %>
                            <% if ((post.reprint_info.reprint_from != undefined) && (user.name == post.reprint_info.reprint_from.name)) { %>
                            <% flag = 0 %>
                            <% } %>
                            <% if ((post.reprint_info.reprint_to != undefined)) { %>
                            <% post.reprint_info.reprint_to.forEach(function (reprint_to, index) { %>
                            <% if (user.name == reprint_to.name) { %>
                            <% flag = 0 %>
                            <% } %>
                            <% }) %>
                            <% } %>
                            <% } else { %>
                            <% flag = 0 %>
                            <% } %>
                            <% if (flag) { %>
                            <a class="edit btn btn-primary btn-sm" href="/reprint/<%= post._id %>">转载</a>
                                <% } %>

                </div>
            </div>
            <% }) %>
            <% include model/pageing.ejs %>
        </div>
        <div id="user_right" class="col-md-4 col-sm-4 clearfix">
            <div id="user_info">
                <div class="user_head">
                    <div class="user_head_portrait "><img src="/images/head_portrait_default.png"><span
                                class="head_name"><%= other_user.name %>
                            <% if(user.name != other_user.name && !isAttention) { %>
                            <a class="attention" href="/users/attention/<%= other_user.name %>">关注</a>
                            <% }else if(isAttention){ %>
                            <a class="remove_attention" href="/users/remove_attention/<%= other_user.name %>">取消关注</a>
                            <% } %>
                        </span>
                    </div>
                    <div class="user_message">
                        <ul>
                            <li>
                                <a><span>广播</span><span><%= other_user.article_number ? other_user.article_number : 0 %></span></a>
                            </li>
                            <li>
                                <a><span>关注</span><span><%= other_user.attention ? other_user.attention.length : 0 %></span></a>
                            </li>
                            <li>
                                <a><span>被关注</span><span><%= other_user.by_attention ? other_user.by_attention.length : 0 %></span></a>
                            </li>
                        </ul>
                    </div>
                </div>
            </div>
        </div>

    </div>
</div>

<% include model/bottom.ejs %>

</body>
</html>



